<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
import { MockAdapter } from '../mock-adapter';
const mock = MockAdapter.getInstance();

import Mock from 'mockjs'

// 获取studio链接数据
mock.onGet('./assets/json/view-config.json').reply((config: any) => {
    let status = MockAdapter.mockStatus(config);
    return [status,{
        <#list app.getAllPSAppViews() as view>
        <#assign num = view_index />
        </#list>
        <#list app.getAllPSAppViews() as view>
        "${view.getCodeName()?lower_case}": {
            "title": "${view.getTitle()}",
            "caption": "${view.getCaption()}",
            "viewtype": "${view.getViewType()}",
            "viewmodule": "${view.getPSAppModule().getCodeName()}",
            "viewname": "${view.getCodeName()}",
            "viewtag": "${view.getId()}"
        }<#if view_index != num>,</#if>
        </#list>
    }];
});

// 获取视图消息分组信息
mock.onGet('./assets/json/view-message-group.json').reply((config: any) => {
    let status = MockAdapter.mockStatus(config);
    return [status,{
        <#if app.getAllPSAppViewMsgGroups()??>
        <#list app.getAllPSAppViewMsgGroups() as viewMsgGroup>
        "<#if viewMsgGroup.getCodeName()??>${viewMsgGroup.getCodeName()}<#else>${viewMsgGroup.getName()}</#if>":[
        <#if viewMsgGroup.getPSAppViewMsgGroupDetails()??>
        <#list viewMsgGroup.getPSAppViewMsgGroupDetails() as viewMsgGroupDetail>
        <#assign viewMessage = viewMsgGroupDetail.getPSAppViewMsg() />
        {"tag":"${viewMessage.getCodeName()}","position":"<#if viewMessage.getPosition() != "">${viewMessage.getPosition()}<#else>TOP</#if>","type":"<#if viewMessage.getMessageType() !="">${viewMessage.getMessageType()}<#else>INFO</#if>"}<#if viewMsgGroupDetail_has_next>,</#if>
        </#list>
        </#if>
        ]<#if viewMsgGroup_has_next>,</#if>
        </#list>
        </#if>
    }];
});